package cn.gdcp.lkqapp20;

import android.animation.ValueAnimator;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {
    private MyCircle myCircle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myCircle = findViewById(R.id.myCirlce);

        int progress = 88;
        ValueAnimator valueAnimator = ValueAnimator.ofInt(0, progress);
        valueAnimator.setDuration(5000);
        valueAnimator.setRepeatCount(5);
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                int value = (int) animation.getAnimatedValue();
                myCircle.setProgress(value);
            }
        });
        valueAnimator.start();

    }
}
